<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改密码</title>
</head>
<body>

<form name="form1" id="form1">

    账号:<input type="text" name="sno"><br>
    <span>邮箱:<input type="email" name="email">  <input type="button" id="sent" value="发送"></span><br>
    验证码:<input type="text" name="code"><br>

    新密码:<input type="password" name="new1"><br>
    确认新密码:<input type="password" name="new2"><br>

  <input type="hidden" name="action" value="modified" readonly="readonly">

  <input type="button" id="yes">确认
</form>

<script type="text/javascript" src="js/jquery-1.8.0.js" ></script>
<script type="text/javascript">
    $(function(){
        function doLogin(){
            var data = $("#form1").serialize();

            $.getJSON("/jiaowuchu/UserServlet",data,function(user){
                if(null != user && "" != user){
                    if(user.yhsf == 0){
                        location = "/jiaowuchu/admin.html";
                    }else if (user.yhsf==1){
                        location = "/jiaowuchu/teacher.html";
                    }else {
                        location="/jiaowuchu/student.html";
                    }
                }else{
                    $("#message").html("用户名或密码错误");
                    setInterval(function (){
                        $("#message").html("");
                    },3000)
                }
            });
        }

        function doSent(){
            var data = $("#form1").serialize();

            $.getJSON("/jiaowuchu/UserServlet",data,function(code){
            });
        }

        $("#yes").click(function(){
            doLogin();
        });

        $("#sent").click(function(){
            doSent();
        });

        //判断如果按下Enter回车键，则登录
        $(document).keydown(function(e){
            e = e || window.event
            if(e.keyCode == 13){//Enter键对应键值为13
                doLogin();
            }
        });

    });
</script>
</body>
</html>